{ INFORMATICS.MCCME.RU
  Problem statement: http://informatics.mccme.ru/moodle/mod/statements/view3.php?chapterid=358
  Verdict: Accepted
}
uses SysUtils, Math;
 
var
	i,j,n,m:longint;
	a:array[0..1010,0..1010] of longint;
	ansV,ansI,curP,ansP,curV:int64;
 
begin
reset(input,'input.txt');
rewrite(output,'output.txt');
fillchar(a,sizeof(a),0);
read(n,m);
for i:=1 to n do
	for j:=1 to m do read(a[i][j]);
ansV:=-1;
ansI:=-1;
ansP:=-1;
for i:=1 to n do begin
	curV:=0;
	curP:=0;
	for j:=1 to m do begin
		inc(curV,a[i][j]);
		curP:=max(curP,a[i][j]);
	end;
	if curP>ansP then begin	
		ansI:=i;
		ansP:=curP;
		ansV:=curV;
	end else
	if (curP=ansP) and (curV>ansV) then begin
		ansI:=i;
		ansV:=curV;
	end;
end;
write(ansI-1);
end.